<?php
  require_once('inc_admin.php');
  //连接数据库   
  connect();
$date = date('y-m-d h:i:s',time());
if($_FILES['zq_jiajulink']['size']>1024*1024*2) {echo "超出范围";}
if(!empty($_FILES["zq_pic"]["name"])){
    $zq_pic = uploadfile('zq_pic',UserPhotoPath,array('jpg','gif','png'));
  }
  else{
    $zq_pic='';
  }
  $data = array(
    'zq_name' => $_POST['zq_name'],
    'zq_brand' => $_POST['brand'],
    'zq_intro' => $_POST['intro'],
    'zq_cid' => $_POST['zq_cid'],
    'zq_adddate' => $date,
    'zq_jiajulink'=>$zq_pic,
    'zq_ischecked'=>$_POST['zq_ischecked']
    );
  //执行SQL语句


  $result = add('jiaju',$data);

  if(!$result){
    echo "添加失败！<br/>";
    echo "<a href='addjiaju.php'>返回</a>";   
  }else{    
    redirect('list.php','添加成功！');
  }    
  
?>
